package com.sskj.xgja.transaction;

import android.os.Bundle;
import android.widget.RelativeLayout;

import com.sskj.xgja.MVPFragment;
import com.sskj.base.utils.ClickUtil;
import com.sskj.xgja.R;
import com.sskj.xgja.login.LoginActivity;

import butterknife.BindView;

/**
 * @author Hey
 * Create at  2019/03/20
 */
public class CheckFragment extends MVPFragment<CheckPresenter> {

    @BindView(R.id.rl_today_entrust)
    RelativeLayout rlTodayEntrust;
    @BindView(R.id.rl_today_deal)
    RelativeLayout rlTodayDeal;
    @BindView(R.id.rl_history_entrust)
    RelativeLayout rlHistoryEntrust;
    @BindView(R.id.rl_history_deal)
    RelativeLayout rlHistoryDeal;

    @Override
    public int getLayoutId() {
        return R.layout.fragment_check;
    }

    @Override
    public CheckPresenter getPresenter() {
        return new CheckPresenter();
    }

    @Override
    public void initView() {
        ClickUtil.click(300, rlTodayEntrust, view -> {
            if (isLogin()) {
                TodayEntrustActivity.start(getActivity());
            } else {
                LoginActivity.start(getContext());
            }
        });
        ClickUtil.click(300, rlTodayDeal, view -> {
            if (isLogin()) {
                TodayDealActivity.start(getActivity());
            } else {
                LoginActivity.start(getContext());
            }
        });
        ClickUtil.click(300, rlHistoryEntrust, view -> {
            if (isLogin()) {
                HistoryEntrustActivity.start(getActivity());
            } else {
                LoginActivity.start(getContext());
            }
        });
        ClickUtil.click(300, rlHistoryDeal, view -> {

            if (isLogin()) {
                HistoryDealActivity.start(getActivity());
            } else {
                LoginActivity.start(getContext());
            }
        });
    }

    @Override
    public void initData() {

    }


    public static CheckFragment newInstance() {
        CheckFragment fragment = new CheckFragment();
        Bundle bundle = new Bundle();
        fragment.setArguments(bundle);
        return fragment;
    }

}
